#ifndef __SEM_H__
#define __SEM_H__

#include "head.h"

#define MEM  0
#define DATA 1

// 操作联合体
union semun
{
     int              val;    /* Value for SETVAL */
     struct semid_ds *buf;    /* Buffer for IPC_STAT, IPC_SET */
     unsigned short  *array;  /* Array for GETALL, SETALL */
     struct seminfo  *__buf;  /* Buffer for IPC_INFO */
};

void sem_set(int semid, int semnum, int val);
bool sem_p(int semid, int semnum);
bool sem_v(int semid, int semnum);

#endif